<?php

class Utils 
{
	public static function userIsAdmin($group_type = array("ROOT_ADMIN", "ADMIN", "SUPER_MOD", "MOD"))
	{
		$me = me();
		if($me===NULL) return false;
		foreach ($group_type as $type) 
		{
			$type = eval("return UserGroup::$type;");
			if($me->group_id==$type)
			{
				return true;
			}
		}
		return false;
	}
	
	public static function lcfirst($str)
	{
		$str[0] = strtolower($str[0]);
		return $str;
	}
	
	public static function AutoFocus($model, $field)
	{
		$errors = array_keys($model->errors);
		if(count($errors)>0) $focus = array($model, $errors[0]);
		else $focus = array($model, $field);
		return $focus;
	}
}
?>